$(function(){
	var teleNumber = false;
	var yanzhenpic = false;
	var yanzhentel = false;
	var firstpassword = false;
	var lastpassword = false;
	
/*-------------------------------------------------------手机号码验证----------------------*/
	$(".biaodan .telNum input").blur(function(){
		var num = $(".biaodan .telNum input").val();
		var re = /^1[34578]\d{9}$/;
		if (re.test(num)) {
			$(".biaodan .telNum .correct").css({"display":"block"})
			$(".biaodan .telNum .wrong").css({"display":"none"})
			teleNumber = true;
		}else{
			$(".biaodan .telNum .correct").css({"display":"none"})
			$(".biaodan .telNum .wrong").css({"display":"block"})			
			teleNumber = false;
		}
		if ((teleNumber == true) && (yanzhenpic == true) && (yanzhentel == true) && (firstpassword == true) && (lastpassword == true)) {
			$("#con .con-down .con-left .open").css({"display":"none"});
		} else{
			$("#con .con-down .con-left .open").css({"display":"block"});	
		}		
	})
	
/*--------------------------------------------------------图片验证码----------------------*/	
	var btn = $(".biaodan .yanzhenpic a");
	var pic = $(".biaodan .yanzhenpic .yanzhen");
	yzm();
	$(".biaodan .yanzhenpic a").click(function(){
		yzm();
		var num = $(".biaodan .yanzhenpic input").val();
		var re = $(".biaodan .yanzhenpic .yanzhen").html();
		if (num===re) {
			$(".biaodan .yanzhenpic .correct").css({"display":"block"})
			$(".biaodan .yanzhenpic .wrong").css({"display":"none"})
			yanzhenpic = true;
		}else{
			$(".biaodan .yanzhenpic .correct").css({"display":"none"})
			$(".biaodan .yanzhenpic .wrong").css({"display":"block"})
			yanzhenpic = false;
		}

	})
	function Rand(min, max) {
		return parseInt(Math.random() * (max - min + 1) + min);
	}
	function yzm(){
		var str = "";
		while(str.length < 4) {
			var num5 = Rand(48, 122)
			if((num5 >= 48 && num5 <= 57) || (num5 >= 65 && num5 <= 90) || (num5 >= 97 && num5 <= 122)) {
				str += String.fromCharCode(num5);
			}
		}
		pic.html(str);
	}

	$(".biaodan .yanzhenpic input").blur(function(){
		var num = $(".biaodan .yanzhenpic input").val();
		var re = $(".biaodan .yanzhenpic .yanzhen").html();
		if (num===re) {
			$(".biaodan .yanzhenpic .correct").css({"display":"block"})
			$(".biaodan .yanzhenpic .wrong").css({"display":"none"})
			yanzhenpic = true;
		}else{
			$(".biaodan .yanzhenpic .correct").css({"display":"none"})
			$(".biaodan .yanzhenpic .wrong").css({"display":"block"})
			yanzhenpic = false;
		}
		if ((teleNumber == true) && (yanzhenpic == true) && (yanzhentel == true) && (firstpassword == true) && (lastpassword == true)) {
			$("#con .con-down .con-left .open").css({"display":"none"});
		} else{
			$("#con .con-down .con-left .open").css({"display":"block"});	
		}		
	})

/*---------------------------------------------------手机短信验证码------------------*/
	$(".biaodan .yanzhentel input").blur(function(){
		var num = $(".biaodan .yanzhentel input").val();
		var re = "";
		if (num!=re) {
			$(".biaodan .yanzhentel .correct").css({"display":"block"})
			$(".biaodan .yanzhentel .wrong").css({"display":"none"})
			yanzhentel = true;
		}else{
			$(".biaodan .yanzhentel .correct").css({"display":"none"})
			$(".biaodan .yanzhentel .wrong").css({"display":"block"})
			yanzhentel = false;
		}
		if ((teleNumber == true) && (yanzhenpic == true) && (yanzhentel == true) && (firstpassword == true) && (lastpassword == true)) {
			$("#con .con-down .con-left .open").css({"display":"none"});
		} else{
			$("#con .con-down .con-left .open").css({"display":"block"});	
		}		
	})

/*---------------------------------------------------密码首次验证-----------------------*/
	$(".biaodan .firstPw input").blur(function(){
		var num = $(".biaodan .firstPw input").val();
		var re = /^[a-z0-9A-Z]{6,16}$/;
		var lastnum = $(".biaodan .lastPw input").val()
		if (re.test(num)) {
			$(".biaodan .firstPw .correct").css({"display":"block"})
			$(".biaodan .firstPw .wrong").css({"display":"none"})
			firstpassword = true;
		}else{
			$(".biaodan .firstPw .correct").css({"display":"none"})
			$(".biaodan .firstPw .wrong").css({"display":"block"})
			firstpassword = false;
		}
		if (num === lastnum) {
			$(".biaodan .lastPw .correct").css({"display":"block"})
			$(".biaodan .lastPw .wrong").css({"display":"none"})
			lastpassword = true;
		}else{
			$(".biaodan .lastPw .correct").css({"display":"none"})
			$(".biaodan .lastPw .wrong").css({"display":"block"})
			lastpassword = false;
		}
		if ((teleNumber == true) && (yanzhenpic == true) && (yanzhentel == true) && (firstpassword == true) && (lastpassword == true)) {
			$("#con .con-down .con-left .open").css({"display":"none"});
		} else{
			$("#con .con-down .con-left .open").css({"display":"block"});	
		}		
	})

/*---------------------------------------------------密码再次验证-----------------------*/

	$(".biaodan .lastPw input").blur(function(){
		var num = $(".biaodan .lastPw input").val();
		var re = $(".biaodan .firstPw input").val();
		if (num === re) {
			$(".biaodan .lastPw .correct").css({"display":"block"})
			$(".biaodan .lastPw .wrong").css({"display":"none"})
			lastpassword = true;
		}else{
			$(".biaodan .lastPw .correct").css({"display":"none"})
			$(".biaodan .lastPw .wrong").css({"display":"block"})
			lastpassword = false;
		}
		if ((teleNumber == true) && (yanzhenpic == true) && (yanzhentel == true) && (firstpassword == true) && (lastpassword == true)) {
			$("#con .con-down .con-left .open").css({"display":"none"});
		} else{
			$("#con .con-down .con-left .open").css({"display":"block"});	
		}		
	})

/*---------------------------------------------------注册按钮验证-----------------------*/
/*if ((teleNumber == true) && (yanzhenpic == true) && (yanzhentel == true) && (firstpassword == true) && (lastpassword == true)) {
	$("#con .con-down .con-left .open").css({"display":"none"});
} else{
	$("#con .con-down .con-left .open").css({"display":"block"});	
}
*/































})

/*----------------------------随机验证码-----------------------------*/
/*	var btn = document.getElementsByClassName("shengcheng")[0]
	
	yzm();

	btn.onclick = function() {
		yzm();
	}
	
	function yzm(){
		var str = "";
		while(str.length < 4) {
			var num5 = Rand(48, 122)
			if((num5 >= 48 && num5 <= 57) || (num5 >= 65 && num5 <= 90) || (num5 >= 97 && num5 <= 122)) {
				str += String.fromCharCode(num5);
			}
		}
		btn.innerHTML = str;
		
	}
	
	function Rand(min, max) {
		return parseInt(Math.random() * (max - min + 1) + min);
	}
	
	
	/*----------------------------验证随机验证码-----------------------------*/
/*	$("#g-bd .sjsc .suiji").blur(function(){
		var suiji = $("#g-bd .sjsc .suiji").val() 
		var shengcheng = $("#g-bd .sjsc .shengcheng").html() 
		if( suiji === shengcheng) {
			$("#g-bd .sjsc .p1").css({
				"display": "block"
			});
			$("#g-bd .sjsc .p2").css({
				"display": "none"
			});
		} else {
			$("#g-bd .sjsc .p1").css({
				"display": "none"
			});
			$("#g-bd .sjsc .p2").css({
				"display": "block"
			});
		}

	})*/